<?php

namespace app\index\controller;

use app\common\model\User;
use think\App;
use think\Controller;

/**
 * 基类
 */
class Base extends Controller
{
    public $user;
    public function __construct(App $app = null)
    {
        parent::__construct($app);
        $userId = session("userId");
        if(!$userId){
            return $this->error("请先登录","/index/login");
        }
        $this->user=User::where("id",$userId)->find();
        $this->assign("user",$this->user);
    }


}